using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public enum InputCommand : byte
{
    Space = 0,
    Up = 1,
    Down = 2,
    Left = 3,
    Right = 4,
}
public class InputManager : MonoBehaviour
{
    void Update()
    {

        if(Input.GetKey(KeyCode.UpArrow))
        {
            EventHandlerMgr.GetInstance().DispatchEvent(EventName.InputMsg, InputCommand.Up);
        }
        else if(Input.GetKey(KeyCode.DownArrow))
        {
            EventHandlerMgr.GetInstance().DispatchEvent(EventName.InputMsg, InputCommand.Down);
        }
        else if(Input.GetKey(KeyCode.LeftArrow))
        {
            EventHandlerMgr.GetInstance().DispatchEvent(EventName.InputMsg, InputCommand.Left);
        }
        else if(Input.GetKey(KeyCode.RightArrow))
        {
            EventHandlerMgr.GetInstance().DispatchEvent(EventName.InputMsg, InputCommand.Right);
        }
        else if(Input.GetKeyDown(KeyCode.Space))
        {
            EventHandlerMgr.GetInstance().DispatchEvent(EventName.InputMsg, InputCommand.Space);
        }
    }
}
